#ifndef __SYS_H
#define __SYS_H

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "stdint.h"
#include "CH57x_common.h"

#define BIT(n) (1 << (n))
#define CLRBIT(c, n) c &= ~BIT(n)
#define SETBIT(c, n) c |= BIT(n)
#define SET_BIT(REG, BIT) ((REG) |= (BIT))
#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
#define READ_BIT(REG, BIT) ((REG) & (BIT))
#define CLEAR_REG(REG) ((REG) = (0x0))
#define WRITE_REG(REG, VAL) ((REG) = (VAL))
#define READ_REG(REG) ((REG))
typedef struct
{
 unsigned char B0 : 1;
 unsigned char B1 : 1;
 unsigned char B2 : 1;
 unsigned char B3 : 1;
 unsigned char B4 : 1;
 unsigned char B5 : 1;
 unsigned char B6 : 1;
 unsigned char B7 : 1;
} bit_field;
#define GETBIT(x) (*((volatile bit_field *)(&x)))

typedef uint32_t u32;
typedef uint16_t u16;
typedef uint8_t  u8;

void SystemClock_UART1_init(void);
#endif
